package com.zrrd.mapper;

import com.zrrd.pojo.Card;
import com.zrrd.pojo.Person;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author WanJl
 * @version 1.0
 * @title OneToOneMapper
 * @description
 * @create 2024/1/23 14:19
 */
public interface OneToOneMapper02 {
    // 身份证表，依赖 人表
    @Select("SELECT * FROM jms2301_db02.card")
    @Results({
            @Result(column = "id",property = "id"),
            @Result(column = "number",property = "number"),
            @Result(column = "pid", //字段
                    property = "p", //变量
                    javaType = Person.class, //变量的类型
                    one=@One(select = "com.zrrd.mapper.PersonMapper.queryById")
            )
    })
    List<Card> queryAll();
}
